﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.UIDesigner.WorkflowStackHeader"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ImgConverter="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner"
    Height="Auto" Width="Auto">
    <UserControl.Resources>
        <ImgConverter:ExecutionStatusImageConverter x:Key="ExecutionStatusImageConverter"/>
        <ImgConverter:UpdateVisibilityConverter x:Key="UpdateVisibilityConverter"/>
        <Storyboard x:Key="progressAnimation" RepeatBehavior="Forever">
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.9000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.9000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:01.2000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource progressAnimation}"/>
        </EventTrigger>
    </UserControl.Triggers>
    <Border CornerRadius="10,10,0,0" Height="40" HorizontalAlignment="Stretch"  Name="headerBorder"  VerticalAlignment="Top"  >
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                <GradientStop Color="#FFDEF0FB" Offset="1"/>
            </LinearGradientBrush>
        </Border.Background>
        <Grid x:Name="header" Background="{x:Null}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="7.5"/>
                <ColumnDefinition Width="26.24"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>

                <ColumnDefinition Width="7.5"/>
            </Grid.ColumnDefinitions>
            <Button Name="btnUpdate" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="4" Click="OnUpdateClick" ToolTip="Upgrade">
                <Button.Content>
                    <Image Width="16" Height="16" Margin="3,0,3,0" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ScientificWorkflow/UpdateActivity.png"/>
                </Button.Content>
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource UpdateVisibilityConverter}">
                        <Binding Path="UpdateAllowedMode" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"/>
                        <Binding Path="UpdateAvailable"/>
                    </MultiBinding>
                </Button.Visibility>
            </Button>
            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" HorizontalAlignment="Right" Margin="0,-4,-5,0" x:Name="rectangleRight" VerticalAlignment="Center" Width="10" Height="10" Grid.Column="5"/>
            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" HorizontalAlignment="Left" Margin="-5,-4,0,0" x:Name="rectangleLeft" VerticalAlignment="Center" Width="10" Height="10" Grid.Column="0"/>
            <Image HorizontalAlignment="Center"  Grid.Column="1" Grid.Row="1" Name="headerImage" Stretch="None" Margin="5,0,0,0"/>
            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Name="headerTextBlock" TextTrimming="CharacterEllipsis" ToolTip="{Binding Path=Text, RelativeSource={x:Static RelativeSource.Self}}"  TextWrapping="NoWrap"  Grid.Column="2"/>
            <Grid Name="grdExecStatus" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="3" Margin="10,-7,20,0" >
                <Grid.RenderTransform>
                    <ScaleTransform ScaleX="0.75" ScaleY="0.75"/>
                </Grid.RenderTransform>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="ExecutingIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=ExecutingImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg2">
                        <Ellipse.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF0D7BB3" Offset="0"/>
                                <GradientStop Color="#FF83C6EC" Offset="1"/>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade2" Margin="3.793,3.087,3.036,11.292">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#00FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    <Rectangle Stroke="{x:Null}" StrokeThickness="1.5" HorizontalAlignment="Left" Margin="7.176,8.309,0,7.691" Width="2.625" Fill="#66FFFFFF" x:Name="rectangle"/>
                    <Rectangle Fill="#66FFFFFF" Stroke="{x:Null}" StrokeThickness="1.5" Margin="11.741,8.309,11.634,7.691" x:Name="rectangle1"/>
                    <Rectangle Fill="#66FFFFFF" Stroke="{x:Null}" StrokeThickness="1.5" Margin="0,8.309,7.069,7.691" Width="2.625" HorizontalAlignment="Right" x:Name="rectangle2"/>
                </Grid>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="ClosedIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=CompletedImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg1">
                        <Ellipse.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF18B30D" Offset="0"/>
                                <GradientStop Color="#FF59E64F" Offset="1"/>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade1" Margin="3.793,3.087,3.036,11.292">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#00FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Margin="5.833,8.333,6.5,6.956" Data="M5.8333333,14 L11.018059,19.04467 19.49939,9.8329158 18.499459,8.3331661 10.632913,14.679488 6.5002874,11.833565 z" Fill="#FFFFFFFF"/>
                </Grid>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="FaultingIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=FaultingImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg3">
                    <Ellipse.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFC42A2A" Offset="0"/>
                            <GradientStop Color="#FFFF6565" Offset="1"/>
                        </LinearGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade3" Margin="3.793,3.087,3.036,11.292">
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                            <GradientStop Color="#B2FFFFFF" Offset="0"/>
                            <GradientStop Color="#00FFFFFF" Offset="1"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="10.784,6.163,10.902,11.149" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z" Fill="#FFFFFFFF"/>
                    <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="11.103,0,11.147,4.834" VerticalAlignment="Bottom" Height="3.928" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                </Grid>
            </Grid>
		<ComboBox x:Name="iterationCombobox" HorizontalAlignment="Center"  Grid.Column="3" VerticalAlignment="Center" Width="Auto" Height="25" BorderThickness="1,1,1,1" Margin="3,3,3,3" IsSynchronizedWithCurrentItem="True" Background="#FFFFFFFF" BorderBrush="#FF999999"  SelectedIndex="0" MinWidth="115" Visibility="Collapsed"  MaxDropDownHeight="117" />

        </Grid>
    </Border>
</UserControl>
